#ifndef GLWIDGET_H
#define GLWIDGET_H

#include <QVector>
#include <QtOpenGL/QtOpenGL>
#include <QtOpenGL/QGLWidget>

#include "Curves/Factories/curvefactory.h"
#include "Curves/Interfaces/icurve.h"
#include "Curves/Objects/bezier.h"
#include "Drawer/curveproperties.h"
#include "Drawer/ogldrawer.h"

typedef ICurve< QPointF > ICurveF;

struct selection
{
    int curve_index;
    int point_index;
};

class GLWidget : public QGLWidget
{
    Q_OBJECT
public:
    explicit GLWidget(QWidget *parent = 0);

    /* Metody. */
    void addCurve( CurveType curveType );
//    void setEditedCurve( int curve ); // Ustawia typ krzywej, ktora bedziemy edytowac.

protected:
    void initializeGL( );
    void resizeGL( int width, int height );
    void paintGL( );

private:
    CurveFactory< QPointF > factory;
    std::vector< ICurveF* > curves;
    std::vector< CurveProperties > properties;

//    enum state mouseState;

    /* Przenoszony punkt. */
    selection moved_point;
    /* Krzywa wybrana aktualnie do rysowania */
//    CurveType krzywa;
    OGLDrawer drawer;
    /* Metody. */
    void draw();
    void mousePressEvent( QMouseEvent* event );
    void mouseMoveEvent( QMouseEvent* event );
    void mouseReleaseEvent( QMouseEvent* event );
    selection curveSelection( int x, int y );

signals:

public slots:

};

#endif // GLWIDGET_H
